import axiosData from '@/api/axios';

export default {
  /**
   * @description: 获取设备台账列表 *代表必填
   * @param {String/Number} page *
   * @param {String/Number} size *
   * @param {Object} entity {} *
   * @return {Array}
   */
  queryPageList(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipment/queryPageList', params);
  },
  /**
   * @description: 获取设备台账列表 *代表必填
   * @return {Array}
   */
  queryAll(params) {
    // return axiosData.post('/v3/agricultural-equipment/v1/equipment/queryAll', params);
    return axiosData.get(`/v3/agricultural-equipment/v1/equipmentType/queryAllNew?organization=${sessionStorage.organizationNo}&farming=${sessionStorage.farming}`, { ...params });
  },
  /**
   * @description: 获取设备生命周期列表 *代表必填
   * @return {Array}
   */
  queryReportForm(params) {
    return axiosData.post('/v3/equipment-ledger/v1/equipment/reportForm', params);
  },
  /**
   * @description: 获取设备列表 *代表必填
   * @return {Array}
   */
  queryEquipment(params) {
    return axiosData.get(`v3/equipment-ledger/v1/equipment/getUnDiscardEquipment?equipmentName=${params}`);
  },
  /**
   * @description: 新增任务模板
   * @param {Object} params *
   * @return {Object}
   */
  add(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipment/add', params);
  },
  /**
   * @description: 编辑设备台账
   * @param {Object} params *
   * @return {Object}
   */
  edit(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipment/edit', params);
  },
  /**
   * @description: 批量删除任务模板
   * @param {Object} params *
   * @return {Object}
   */
  delList(params) {
    return axiosData.post('/v3/agricultural-equipment/v1/equipment/deleteAll', params);
  },
  /**
   * @description:检测设备名称是否已被占用
   * @param {Object} params *
   * @return {Object}
   */
  queryBeOccupied(params) {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipment/queryBeOccupied?equipmentName=${params}`);
  },
  /**
   * @description:查询设备信息
   * @param {Object} params *
   * @return {Object}
   */
  query(params) {
    return axiosData.get(`/v3/agricultural-equipment/v1/equipment/queryByEquipmentCode?equipmentCode=${params}`);
  },
  /**
   * @description:查询设备视频
   * @param {String/Number} params *
   * @return {Object}
   */
  queryEquipVideos(params) {
    return axiosData.get(`/v3/equipment-base/v1/equipmentVideo/getFileById?equipmentVideoId${params}`);
  },
  /**
   * @description:添加设备视频
   * @param {FormData} params *
   * @return {Object}
   */
  addEquipVideos(params) {
    return axiosData.post1(`/v3/equipment-base/v1/equipmentVideo/add`, params);
  },
  /**
   * @description:绑定设备视频
   * @param {FormData} params *
   * @return {Object}
   */
  bindEquipmentAndVideo(params) {
    return axiosData.post(`/v3/equipment-ledger/v1/equipment/bindEquipmentAndVideo`, params);
  }
};
